home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / search / lsmtool-.6 / lsmtool- / lsmtool-0.6 / lsm.h < prev    next >
C/C++ Source or Header  |  1994-11-11  |  1KB  |  52 lines

  1. /*
  2.  * lsm.h -- global declarations for LSM utilities.
  3.  *
  4.  * Lars Wirzenius
  5.  * "@(#)lsm:lsm.h,v 1.3 1994/11/11 19:14:49 wirzeniu Exp"
  6.  */
  7.  
  8. #ifndef lsm_h_included
  9. #define lsm_h_included
  10.  
  11.  
  12. #include <stdio.h>        /* need size_t, FILE */
  13.  
  14.  
  15. /*
  16.  * Maximum number of fields in one entry.
  17.  */
  18. #define MAX_FIELDS      128
  19.  
  20. /*
  21.  * One entry.  The fields are identified by indexes; all entries have the
  22.  * fields in the same order in the internal representation.  The mapping
  23.  * between fields and indexes is done by lsm_field_to_index.
  24.  *
  25.  * Not all fields need be given; empty fields are set to
  26.  * NULL.  Each field value will have its leading white space removed from
  27.  * the first line (and the first line only), and will end in a newline.
  28.  */
  29. struct lsm_entry {
  30.     char *fields[MAX_FIELDS];
  31. };
  32.  
  33.  
  34. /*
  35.  * A database is a number of entries.  This table is resized dynamically.
  36.  */
  37. struct lsm_database {
  38.     struct lsm_entry *entries;
  39.     size_t nentries, nalloc;
  40. };
  41.  
  42.  
  43. int lsm_field_to_index(const char *);
  44. const char *lsm_index_to_field(int);
  45. int lsm_read_one_entry(FILE *, long *, struct lsm_entry *);
  46. int lsm_read_database(FILE *, struct lsm_database *);
  47. int lsm_write_one_entry(FILE *, const struct lsm_entry *);
  48. int lsm_write_database(FILE *, struct lsm_database *);
  49. int lsm_check_entry(struct lsm_entry *, const char *);
  50.  
  51. #endif
  52.